<!DOCTYPE html>
<title>Test synthetic gestures from a cross origin iframe</title>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>

<iframe style="width: 500px; height: 500px;" src="http://localhost:8000/misc/resources/iframe-initiating-gesture.html"></iframe>

<script>

// Have an OOPIF perform a synthetic gesture over itself to test that
// 1) OOPIFs can initiate synthetic gestures, and
// 2) the synthetic gesture mechanism knows to route events to the correct
//    frame in the presence of OOPIFs.
async_test(t => {
  window.addEventListener('message', t.step_func_done((e) => {
    assert_equals(e.data, 'pass');
  }), { once: true });

  window.addEventListener('load', () => {
    var subFrame = document.getElementsByTagName('iframe')[0];
    subFrame.contentWindow.postMessage({
      framePosition: {
        x: subFrame.getBoundingClientRect().x,
        y: subFrame.getBoundingClientRect().y,
      }
    }, '*');
  });
});

</script>
